package com.sniper.mybatis.service.impl;

import com.sniper.model.SetPassword;
import com.sniper.mybatis.dao.BaseDao;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service("setPasswordService")
public class SetPasswordServiceImpl extends BaseServiceImpl<SetPassword>
        implements SetPasswordService {

    @Resource
    @Override
    public void setDao(BaseDao<SetPassword> dao) {
        super.setDao(dao);
    }

    @Override
    public SetPassword validBySign(String sign) {
        Map<String, Object> params = new HashMap<>();
        params.put("sign", sign);
        params.put("signaTrue", false);
        List<SetPassword> passwords = query("select", params);
        if (passwords.size() > 0) {
            return passwords.get(0);
        }
        return null;
    }

}
